package com.cet.recon.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 30952
 */
@Configuration
public class RabbitConfig {

    @Bean
    public Exchange reconExchange() {
        return ExchangeBuilder
                .topicExchange("recon.exchange")
                .durable(true)
                .build();
    }

    // 可选：如果你想收那条 summary，可以顺便建队列和绑定
    @Bean
    public Queue reconSummaryQueue() {
        return QueueBuilder.durable("recon.summary.queue").build();
    }

    @Bean
    public Binding reconSummaryBinding(Queue reconSummaryQueue, Exchange reconExchange) {
        return BindingBuilder
                .bind(reconSummaryQueue)
                .to((TopicExchange) reconExchange)
                .with("recon.daily.summary");
    }
}
